home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
os2
/
gjboxx25.zip
/
MIDPLAY.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-05-13
|
31KB
|
1,034 lines
/**************************************************************
* *** MIDPLAY - Grin's Simple MIDi Jukeboxx ***
*
* version 2.50
*
* Copyright 1995-96, Peter Gervai. Free for personal use.
*
* Usage:
* MidPlay [<file pattern>] [@<playlist name>] [<file pattern>] [switches]
*
* Switches: /V<vol> Set global volume
* /R<vol> Set right volume (stereo only)
* /L<vol> Set left volume (stereo only)
* /S Shuffle play - randomize musics
* Examples:
* MidPlay
* Plays all *.MID files in the current directory
*
* MidPlay /S E:\TMP\MIDI\A*.MID M:\IDI\"C64 Evergreens"\*
* Plays the given files of the given directory, shuffled
*
* MidPlay TheSatan.Mid @hellish.list
* Plays the Satan's song then all files in the playlist
***************************************************************
*
* (This program eats up very few CPU cycles. You can use it in the
* background.)
*
* License
* If you are using the program in a non-commercial environment
* then you're free to use, copy, or delete it. You must not sell it.
* You can include it on CDRoms or in shareware catalogs.
* Commercial users should contact me about the license fees.
*
* This program is copyrighted material of Peter Gervai, Hungary.
* Please do not distribute modified versions without my approval. Thanks!
*
*
*
* PLEASE tell me about your ideas about the program!
*
*
* History:
* 1.0 - Release the in-house version
* 1.1 - Pause song, bad MIDi file handling
* 1.2 - Error control, restart
* 1.3 - Handle HPFS extreme filenames (space, comma, etc in names)
* 1.99 - Seeking
* 2.0 - New interface ;-) : direct keyboard, pos display, volumes
* 2.1 - New interface strikes back: borders, volume, buttons'n'boxes
* 2.2 - More paths on commandline (the song counter cheats, though!)
* 2.21 - Use the more general "sequencer" device instead of "sequencerNN"
* 2.3 - Don't close sequencer instance. This helps playing type0
* MIDis without exact channel programming (uses the already loaded
* intruments... <sigh>)
* - The INIT midi created
* - inet email address changed :(
* 2.31 - volume won't change to 100% after play a new song
* - volume can be preset [now only in the source]
* - The INIT midi is searched where MidPlay resides. Hopefully. :)
* - nasty logical error fixed when multiple filenames on
* commandline were with spaces in them. It wasn't my fault... ;->
* 2.40 - shuffle play
* - fix song counter to count every file
* - using command line params for preset volume (are you happy, Costas? :))
* - email changed again.... hrrgh
* 2.50 - colors! [It looks almost like a REAL MIDiplayer... ;-)]
* - fixed B_Plain for volbars and percent bars :)
* - using playlists! you can store favourite midis from all over your
* harddisk. Use full paths where needed. One name per line.
* - some minor fix
*
* TODO:
* - nicer error messages (eg. ~~~INI~~~ file not found, bad midi)
* (hmm, well, I like it this way :->)
* - ? your ideas ?
*
* Author
* Peter "Grin" Gervai, 2:370/15@fidonet, 81:436/3@OS2Net,
* grin@lifeforce.fido.hu
*/
call RxFuncAdd "SysFileTree", "RexxUtil", "SysFileTree"
call RxFuncAdd "SysSleep", "RexxUtil", "SysSleep"
call RxFuncAdd "SysCls", "RexxUtil", "SysCls"
call RxFuncAdd "SysGetKey", "RexxUtil", "SysGetKey"
call RxFuncAdd "SysCurPos", "RexxUtil", "SysCurPos"
/* Record error and get back to work*/
Call on failure name error1
Call on halt name error2
/*signal on syntax name error3*/
/*******************************************************************
* Character Schemes
*
* Usually you are supposed to use the PC charset, but
* some national codepage just fucks up the box chars...
*
*/
/* 12345678901234567 graph schemes for tables and buttons */
B_Plain = "+-+|+-+| ++++#*<>"
B_Pc = "┌─┐│└─┘│ ├┤┬┴▒░"
/*******************************************************************
* Color Schemes
*
*
* 0(8) =black 1(9) =red 2(10)=green 3(11)=brown 4(12)=blue
* 5(13)=purple 6(14)=cyan 7(15)=white
*/
/* 1 background, 2 statusline, 3 counter, 4 songbar, 5 totalsec, 6 secbar,
* 7 actualsec, 8 total header, 9 volbar, 10 volheader,
* 11 buttonborder, 12 buttonchar, 13 buttonshadow, 14 pausebg,
* 15 errorcol */
/* My colours. Cold and blue of course! */
C_Grin = '15,4 14,4 7,4 15,4 6,4 12,4',
'11,4 14,4 13,4 6,4',
'14,4 15,4 8,0 0,4',
'9,0'
/* This set is called: "Ouch!" :) */
C_Test = '15,4 14,5 1,6 15,2 3,7 4,7',
'0,4 13,1 13,4 6,4',
'15,1 0,2 8,0 14,7',
'9,0'
ProgVersion = "2.50"
/*******************************************************************
*
* You can change these
*
*/
/* we use PC characters to display graphics :) */
styp = B_Pc
/* use my favourite color scheme :) */
ctyp = C_Grin
/* use colors (if you set it to 0 you will get no ANSI colors at all) */
C_UseColors = 1
/* use 90% as the starting volume [value: 0-100] */
lvol = 90
rvol = 90
/* verbose mode */
VerboseMode = 1
/*
* ...do not change after that.
*
*******************************************************************/
LastLeftVol = -1
LastRightVol = -1
LastTotalsBar = -1
StereoUnchecked = 1
shufflePlay = 0
initfilename = '~~init~~.mid' /* this IS case sensitive! */
file.0 = 0
globals = 'SupportStereoVol LastTotalsBar LastPercent LastLeftVol',
'LastRightVol C_UseColors colors. oldchar oldbg VerboseMode',
'styp ctyp lvol rvol'
/* Send commands to OS/2 command processor. */
address cmd
FILE=''
Parse Arg pattern
parse source . . myself
mypath = SubStr(myself,1,LastPos('\',myself))
if pattern=='' then pattern='*.MID'
Do while pattern \== ''
/* first word --> pattern
* rest --> restpattern
*/
call ParseNextName
select
when Left(pattern,1) = '/' then do
/* command line switch */
swChar = Translate(SubStr(pattern,2,1))
swArg = SubStr(pattern,3)
select
when swChar = 'R' then do
/* right volume */
if swArg<0 | swArg>100 then call ArgError 'Illegal volume' swArg
rvol = swArg
end
when swChar = 'L' then do
/* left volume */
if swArg<0 | swArg>100 then call ArgError 'Illegal volume' swArg
lvol = swArg
end
when swChar = 'V' then do
/* global volume (have priority) */
if swArg<0 | swArg>100 then call ArgError 'Illegal volume' swArg
lvol = swArg
rvol = swArg
end
when swChar = 'S' then do
/* set shuffle play */
shufflePlay = 1
end
when swChar = 'H' | swChar = '?' then do
/* help */
Call ShowHelp
exit 1;
end
otherwise call ArgError 'Unknown switch' swChar
end
end
when Left(pattern,1) = '@' then do
/* playlists */
if VerboseMode then say 'Processing playlist' SubStr(pattern,2)'...'
call ReadPlaylist SubStr(pattern,2)
end
otherwise do
/* filename pattern */
if VerboseMode then say 'Scanning pattern' pattern'...'
CALL SysFileTree pattern,'filebuf','F'
if filebuf.0 = 0 then say 'Warning, no MIDi found at' pattern'!'
/*
* append filebuf. to file.
*/
counter = file.0
do i=1 to filebuf.0
if pos(initfilename,filebuf.i)=0 then do
/* I don't want to listen the INIT twice... */
counter = counter + 1
file.counter = filebuf.i
end
end
file.0 = counter
end
end
/* read the rest of the command l